Page({
  data: {
    notificationSettings: {
      pushEnabled: true,
      soundEnabled: true,
      vibrationEnabled: true,
      newMessage: true,
      newFollow: true,
      newLike: true,
      newComment: true,
      systemNotice: true,
      marketingMessage: false
    }
  },

  // 切换通知设置
  onToggleSetting(e) {
    const { field } = e.currentTarget.dataset;
    const { value } = e.detail;
    
    this.setData({
      [`notificationSettings.${field}`]: value
    });

    wx.showToast({
      title: value ? '已开启' : '已关闭',
      icon: 'success'
    });
  },

  // 保存设置
  onSaveSettings() {
    wx.showLoading({
      title: '保存中...'
    });

    setTimeout(() => {
      wx.hideLoading();
      wx.showToast({
        title: '设置已保存',
        icon: 'success'
      });
      
      setTimeout(() => {
        wx.navigateBack();
      }, 1000);
    }, 1000);
  }
}); 